package com.hz.monitoring.module.hardware.dal.mysql.monitoring_warning_log;

import java.util.*;

import com.hz.monitoring.framework.common.pojo.PageResult;
import com.hz.monitoring.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hz.monitoring.framework.mybatis.core.mapper.BaseMapperX;
import com.hz.monitoring.module.hardware.dal.dataobject.monitoring_warning_log.MonitoringWarningLogDO;
import org.apache.ibatis.annotations.Mapper;
import com.hz.monitoring.module.hardware.controller.admin.monitoring_warning_log.vo.*;

/**
 * 预警日志 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MonitoringWarningLogMapper extends BaseMapperX<MonitoringWarningLogDO> {

    default PageResult<MonitoringWarningLogDO> selectPage(MonitoringWarningLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MonitoringWarningLogDO>()
                .eqIfPresent(MonitoringWarningLogDO::getSensorTenantResourceId, reqVO.getSensorTenantResourceId())
                .eqIfPresent(MonitoringWarningLogDO::getMcuTenantResourceId, reqVO.getMcuTenantResourceId())
                .betweenIfPresent(MonitoringWarningLogDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(MonitoringWarningLogDO::getId));
    }

    default List<MonitoringWarningLogDO> selectList(MonitoringWarningLogExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MonitoringWarningLogDO>()
                .eqIfPresent(MonitoringWarningLogDO::getSensorTenantResourceId, reqVO.getSensorTenantResourceId())
                .eqIfPresent(MonitoringWarningLogDO::getMcuTenantResourceId, reqVO.getMcuTenantResourceId())
                .betweenIfPresent(MonitoringWarningLogDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(MonitoringWarningLogDO::getId));
    }

}
